package com.bcbim.model_server.file.mapper;

import com.bcbim.model_server_interface.component.bo.ComponentTreeBO;
import com.bcbim.model_server_interface.file.dao.FileDAO;
import com.bcbim.model_server_interface.file.dto.FileListDTO;
import com.bcbim.model_server_interface.file.vo.FileInfoVO;
import com.bcbim.model_server_interface.file.vo.FileModelInfoVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Description: 文件mapper
 * @Author: ye
 * @Date: 2022/3/25
 * @Version: V1.0
 **/
@Mapper
public interface FileMapper {

    /**
     * @Description: 保存文件
     * @Param: FileDAO
     * @Return: int
     * @Author: ye
     * @Date: 2022/3/28
     */
    int insertFile(FileDAO file);

    /**
     * @Description: 修改文件状态
     * @Param: FileDAO
     * @Return:
     * @Author: ye
     * @Date: 2022/4/11
     */
    void updateFileById(FileDAO fileDAO);

    /**
     * @Description: 根据id查询文件信息
     * @Param: fileId
     * @Return: FileInfoVO
     * @Author: ye
     * @Date: 2022/4/14
     */
    FileModelInfoVO getFileModelById(String fileId);

    /**
     * @Description: 查询文件信息
     * @Param: List<String>
     * @Return: List<FileInfoVO>
     * @Author: ye
     * @Date: 2022/5/6
     */
    List<FileInfoVO> getFileInfo(@Param("list") String[] fileIds);

    /**
     * @Description: 查询构件树文件根节点
     * @Param: id
     * @Return: ComponentTreeBO
     * @Author: ye
     * @Date: 2022/5/11
     */
    ComponentTreeBO getFileRoot(String id);

    /**
     * @Description: 更新剩余流量
     * @Param: appKey
     * @Param: fileSize
     * @Return:
     * @Author: ye
     * @Date: 2022/7/4
     */
    void updateApplicationResidualFlow(@Param("appKey") String appKey, @Param("fileSize") long fileSize);

    /**
     * @Description: 文件列表数量
     * @Param:
     * @Return: int
     * @Author: ye
     * @Date: 2022/3/25
     */
    int countFile(FileListDTO query);

    /**
     * @Description: 文件列表
     * @Param:
     * @Return: List<FileInfoVO>
     * @Author: ye
     * @Date: 2022/3/25
     */
    List<FileInfoVO> listFile(FileListDTO query);

    /**
     * @Description: 删除文件
     * @Param: fileId
     * @Return: int
     * @Author: ye
     * @Date: 2022/3/25
     */
    int removeFile(String fileId);
}
